// 工具类
import { ElNotification, ElMessageBox } from "element-plus";
// 封装消息提示
export const Toast = (msg, type = 'success') => {
  ElNotification({
    message: msg,
    type: type,
  });
};

// 消息弹框
export function showModal(tip, value = "") {
  return ElMessageBox.prompt(tip, '', {
    confirmButtonText: '确认',
    cancelButtonText: '取消',
    inputValue: value
  })
}

// 将query对象转成url参数
export function queryParams(query) {
  let q = []
  for (const key in query) {
    if (query[key]) {
      q.push(`${key}=${encodeURIComponent(query[key])}`)
    }
  }
  let r = q.join("&")
  r = r ? ("?" + r) : ""
  return r
}
